<template>
  <div>
    <h3>SubItem组件</h3>
    <p>已知库存数: {{ count }}</p>
    <button @click="sub">库存-1</button>
  </div>
</template>

<script>
import { mapState, mapMutations } from 'vuex'
export default {
  computed: {
    ...mapState(['count'])
  },
  methods: {
    ...mapMutations(['subCount']),
    sub() {
      this.subCount()
    }
  }
}
</script>
